package LogicTest;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import Logic.SaleManagerLogic.SaleManagerLogicInterface;
import Po.BookPO;
import Po.IdCustomer;
import Po.ManagerCustomer;
import Po.Message;
import Po.Order;
import Po.Result;
import Po.State;

public class SaleManagerLogic {

	SaleManagerLogicInterface test;
	
	@Before
	public void setUp() throws Exception {
		//TODO
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAllCustomer() {
		ArrayList<IdCustomer> l = test.getAllCustomer();
		Assert.assertTrue(l.size() == 1);
		Assert.assertTrue(l.get(0).name.equals(""));
	}
	
	@Test
	public void testGetCustomer() {
		ManagerCustomer m = test.getCustomer(0);
		Assert.assertTrue(m.ID == 0);
	}
	
	@Test
	public void testPresent() {
		Message m = test.presentPromotion(null, 0, 0);
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testModifyOrder() {
		Message m = test.modifyOrder(0, State.order);
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testAddNode() {
		Message m = test.addNode("", "");
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testDelNode() {
		Message m = test.deleteNode("");
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testModifyNode() {
		Message m = test.modifyNode("", "");
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testAddBook() {
		Message m = test.addBook(new BookPO("", "", "", 0, "", "", 1));
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	@Test
	public void testDelBook() {
		Message m = test.deleteBook("");
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	@Test
	public void testModifyBook() {
		Message m = test.modifyBook(null);
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testLogin() {
		Message m = test.login(null);
		Assert.assertTrue(m.result == Result.Success);
		Assert.assertTrue(m.reason.equals(""));
	}
	
	@Test
	public void testGetDetail() {
		BookPO m = test.getBookDetail("1");
		Assert.assertTrue(m.iSBN.equals("1"));
	}
	
	@Test
	public void testGetAviOrder() {
		ArrayList<Order> l = test.getAvailableOrder();
		Assert.assertTrue(l.size() == 1);
		Assert.assertTrue(l.get(0).address.equals(""));
	}

}
